Skip to content

Conversation

@hyperpolymath
Copy link
Owner

No description provided.

claude and others added 5 commits December 17, 2025 00:32
Add extensive documentation covering:

Roadmap (ROADMAP.md):
- Complete development roadmap through v1.0
- Phase-by-phase implementation plan
- Testing strategy with property-based testing
- Standard library and framework ecosystem plans
- Milestone definitions and release schedule

Wiki documentation (wiki/):
- Language reference: lexical structure, types, ownership,
  effects, traits, modules, dependent types, row polymorphism,
  patterns, functions
- Compiler implementation guides: architecture, lexer, parser,
  type checker, borrow checker, code generation
- Tooling: CLI reference, REPL guide
- Testing: comprehensive testing guide with property-based
  testing inspired by Echidna/QuickCheck
- Standard library overview
- Tutorials: introduction and quick start guide

This documentation provides a foundation for contributors and
users to understand the language design and implementation.
Implement a complete Menhir parser covering:

Expressions:
- Literals (int, float, string, char, bool, unit)
- Variables and field access
- Binary operators with correct precedence
- Unary operators (negation, not, ref, deref)
- Function calls and indexing
- Tuples, arrays, and records
- If/else and match expressions
- Lambda expressions
- Blocks and let bindings
- Effect handlers and resume

Types:
- Simple types and type constructors
- Generic types (Option[T], Vec[n, T])
- Function types with optional effects
- Tuple and record types
- Row polymorphism ({x: Int, ..r})
- Ownership modifiers (own, ref, mut)

Patterns:
- Wildcards, variables, literals
- Constructor patterns
- Tuple and record patterns
- Or-patterns and binding patterns

Declarations:
- Functions (with total, generic, effects)
- Structs and enums
- Type aliases
- Traits and implementations
- Effect declarations
- Imports and modules

Also includes:
- Parse driver bridging sedlex and Menhir
- Comprehensive parser test suite (60+ tests)
- CLI integration for 'parse' command
…ructure

Phase 2 implementation of AffineScript:

REPL & Interpreter:
- value.ml: Runtime value representation with linear tracking
- eval.ml: Tree-walking interpreter with pattern matching
- repl.ml: Interactive REPL with commands (:help, :env, :debug, etc.)
- stdlib.ml: Standard library modules (Math, String, Array, Option, Result)

Semantic Analysis:
- symbol.ml: Symbol table with scope management
- resolve.ml: Name resolution pass for all AST nodes
- types.ml: Internal type representation (QTT quantities, rows, effects)
- typecheck.ml: Bidirectional type checker with unification
- borrow.ml: Affine type borrow checker (use-after-move detection)

Code Generation:
- codegen.ml: WebAssembly code generator (WAT output)

CLI Updates:
- Added 'repl', 'run', and 'eval' commands
- Integrated stdlib prelude loading

Examples:
- hello.afs, fibonacci.afs, factorial.afs
- higher_order.afs, records.afs, enums.afs

Tests:
- test_eval.ml: 35+ interpreter tests
Add comprehensive compiler infrastructure:
- lib/wasm_binary.ml: Full WASM binary encoder with LEB128, sections
- lib/dependent.ml: Dependent types (length-indexed vectors, refinements)
- lib/effects.ml: Algebraic effects and handlers runtime
- lib/package.ml: Package manager with semver, dependency resolution
- lib/lsp.ml: Language Server Protocol implementation

Add standard library in library/:

Common library (library/common/):
- prelude.afs: Core types (Option, Result), traits (Eq, Ord, Iterator)
- collections.afs: Vec, HashMap, HashSet, LinkedList, BinaryHeap
- io.afs: IO effect, file handling, streams, buffered I/O
- async.afs: Futures, channels, async primitives
- string.afs: String utilities, StringBuilder
- math.afs: Math functions, constants, statistics, RNG
- time.afs: Duration, Instant, DateTime
- sync.afs: Atomics, spinlocks, RwLock, barriers

AffineScript-specific library (library/affinescript/):
- linear.afs: Linear types, tokens, session types
- effects.afs: Effect handlers (Reader, Writer, State, Except)
- ownership.afs: Box, Rc, Weak, Cow, RefCell
- refinements.afs: Positive, NonZero, Vec[N,T], Matrix[M,N,T]

Total: ~8400 lines of new code
@hyperpolymath hyperpolymath merged commit 602c22b into main Dec 17, 2025
1 of 3 checks passed
@hyperpolymath hyperpolymath deleted the claude/language-roadmap-planning-PjmQg branch December 17, 2025 14:46
}

let init_state root =
let home = Sys.getenv_opt "HOME" |> Option.value ~default:"/tmp" in

Check warning

Code scanning / Semgrep OSS

Semgrep Finding: ocaml.lang.portability.slash-tmp.not-portable-tmp-string Warning

You should probably use Filename.get_temp_dirname().
(** Read manifest from file *)
let read_manifest path =
try
let ic = open_in path in

Check warning

Code scanning / Semgrep OSS

Semgrep Finding: ocaml.lang.portability.crlf-support.prefer-read-in-binary-mode Warning

'open_in' behaves differently on Windows and on Unix-like systems with respect to line endings. To get the same behavior everywhere, use 'open_in_bin' or 'open_in_gen [Open_binary]'. If you really want CRLF-to-LF translations to take place when running on Windows, use 'open_in_gen [Open_text]'.

(** Write manifest to file *)
let write_manifest path manifest =
let oc = open_out path in

Check warning

Code scanning / Semgrep OSS

Semgrep Finding: ocaml.lang.portability.crlf-support.prefer-write-in-binary-mode Warning

'open_out' behaves differently on Windows and on Unix-like systems with respect to line endings. To get the same behavior everywhere, use 'open_out_bin' or 'open_out_gen [Open_binary]'. If you really want LF-to-CRLF translations to take place when running on Windows, use 'open_out_gen [Open_text]'.
let _ = Sys.command (Printf.sprintf "mkdir -p %s/test" state.pm_root) in
(* Create main.afs *)
let main_path = Filename.concat state.pm_root "lib/main.afs" in
let oc = open_out main_path in

Check warning

Code scanning / Semgrep OSS

Semgrep Finding: ocaml.lang.portability.crlf-support.prefer-write-in-binary-mode Warning

'open_out' behaves differently on Windows and on Unix-like systems with respect to line endings. To get the same behavior everywhere, use 'open_out_bin' or 'open_out_gen [Open_binary]'. If you really want LF-to-CRLF translations to take place when running on Windows, use 'open_out_gen [Open_text]'.
(** Load and execute a file *)
let load_file state filename =
try
let ic = open_in filename in

Check warning

Code scanning / Semgrep OSS

Semgrep Finding: ocaml.lang.portability.crlf-support.prefer-read-in-binary-mode Warning

'open_in' behaves differently on Windows and on Unix-like systems with respect to line endings. To get the same behavior everywhere, use 'open_in_bin' or 'open_in_gen [Open_binary]'. If you really want CRLF-to-LF translations to take place when running on Windows, use 'open_in_gen [Open_text]'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants